Flash memories have been widely used in various fields, since such memories have high density, large memory capacity, comparatively less time consumption for read/write operations, and nonvolatile ability. However, flash memories have been limited in application due to inherent defects thereof. In one aspect, some special operations are induced due to special write and block erase operations of the flash memory. Generally, in the write operation of a flash memory, original data in an object block to be operated are fetched into a RAM (Random Access Memory) and the object block is then erased. Since data writing into a flash memory block is implemented in page units sequentially, original data in preceding pages are written into the erased object block firstly. Then, new data and the original data in posterior pages are written into the object block. At last, block managing information is updated. During such a complicated process, unrecoverable errors may occur. For example, in case the power is down during the erase operation on the object block, if data writing is not completed in the operated object block and the information in a mapping table is not updated, the old data will become invalid. In another aspect, a flash memory usually has a lifetime determined by its own storage principle. Generally, floating grids of storage units in a flash memory are discharged (i.e., erase) to a general state at first, and then charged (i.e., program) to a required state for storing data. During the repeated erase and program operations, more and more electrons are captured by the floating grids due to a tunnel effect. When the captured electrons come up to a certain amount, a larger voltage is required to charge the floating grids. In this situation, the lifetime of the flash memory expires. A NOR type flash memory is generally able to be erased or reprogrammed for about 10,000 times. A NAND type flash memory is generally able to be erased or reprogrammed for about 100,000 times.
The above-mentioned numerical values are only average values in theory. In practice, the lifetime of a flash memory is far less than the theoretical value. This is mainly because the operating frequencies of various blocks are different. Some blocks are erased or reprogrammed more frequently and become bad blocks very soon. When a certain number of bad blocks are contained in a flash memory, the flash memory is unusable and its lifetime expires. Meanwhile, some other blocks are used less frequently, or even seldom used until the flash memory is out of work, which is quite wasteful. At present, many flash memory manufacturers reserve some space in flash memory chips for replacing the bad blocks to prolong the lifetime of the flash memory. However, blocks in the flash memory still cannot be used sufficiently and a lot of flash memory resources are wasted.
A Chinese Patent Application “A Method for Protecting Data in a Flash Memory Medium” (Publication No. CN1567256 A) discloses a method for writing data in a flash memory medium. During each write operation, a blank block is selected as a storing block for the current write operation. Original data in an object block and new data are written into the storing block. Information on correlation between a logical address of the object block and that of the storing block is recorded in an address mapping table in the flash memory medium. During operations, an original block and a new block are addressed according to the information recorded in the address mapping table. The method is mainly directed to protect data written into the flash memory medium before an illegal power failure during the data writing. However, it is complicated to be implemented, since much more time is required in each of write operations to find a blank block to be written. Besides, too many redundant information regions in the blocks are occupied to record information such as mapping addresses to ensure the data security. In addition, according to the method, blank blocks with preceding addresses are used more frequently, causing the using frequencies of blocks to be uneven, so that the lifetime of the flash memory expires earlier.